<template>
  <svg :style="{ width, height }" aria-hidden="true">
    <use :xlink-href="prefix + name" :fill="color"></use>
  </svg>
</template>
<script setup lang="ts" name="SvgIcon">
//接受父组件传递的参数
defineProps({
  //xlink:href的属性值前缀
  prefix: {
    type: String,
    default: "#icon-",
  },
  //图标名称
  name: {
    type: String,
    required: true,
  },
  //图标的颜色
  color: {
    type: String,
    default: "#000",
  },
  //图标的宽度
  width: {
    type: String,
    default: "16px",
  },
  //图标的高度
  height: {
    type: String,
    default: "16px",
  },
});
</script>
<style scoped></style>
